{% load kegweblib %}
<div class="kb-tapbox">
  <div class="kb-tapbox-header">
    <h2><a href="{% url pykeg.web.kegweb.views.keg_detail keg.seqn %}">{% if keg.tap %}{{ keg.tap.name }}: {% endif %} {{ keg.type.name }}</a></h2>
    <span class="kb-byline">{{ keg.size.name }}, tapped {% timeago keg.startdate %}</span>
  </div>
  <div class="kb-tapbox-content">
    <table border="0">
      <tr>
        <td align="center" valign="center">
          {% include "kegweb/keg-image.html" %}
        </td>
        <td valign="top">
          <div class="kb-tapbox-detail">
            <div class="kb-tapbox-stats">
              <p>
                <b>Total Poured</b>:
                {{keg.served_volume.ConvertTo.Pint|floatformat:0}} pints
                {% if keg.is_empty %}
                  (empty!)
                {% else %}
                  ({{keg.remaining_volume.ConvertTo.Pint|floatformat:0}} remain)
                {% endif %}
                {% chart keg_volume keg 320 50 %}
                </p>

              {% if keg.tap %}
              {% if keg.tap.temperature_sensor %}
              <p>
                <b>Temperature</b>:
                {{ keg.tap.Temperature.TempC|floatformat:1}}&deg;C /
                {{ keg.tap.Temperature.TempF|floatformat:1}}&deg;F
              {% chart sensor keg.tap.temperature_sensor 320 50 %}
              </p>
              {% endif %}
              {% endif %}
            </div>
          </div>
        </td>
      </tr>
    </table>

  </div>
</div>

